package com.gdkj.enums;

/**
 * 分享通关奖励枚举
 *  1 金豆 2 钻石 3 土 4 护盾 5 小黑屋 6 钥匙
 * @author chenyanqian
 * @date 2022/11/3
 */
public enum DiggingShareRewardTypeEnums {

    /**
     * 金豆
     * @author chenyanqian
     * @date 2022/11/3
     */
    GOLD_BEAN(1, "金豆"),

    /**
     * 钻石
     * @author chenyanqian
     * @date 2022/11/3
     */
    ENERGY(2, "钻石"),

    /**
     * 土壤
     * @author chenyanqian
     * @date 2022/11/3
     */
    SOIL(3, "土壤"),

    /**
     * 护盾
     * @author chenyanqian
     * @date 2022/11/3
     */
    SHIELD(4, "护盾"),

    /**
     * 小黑屋
     * @author chenyanqian
     * @date 2022/11/3
     */
    BLACK_HOUSE(5, "小黑屋"),

    /**
     * 钥匙
     * @author chenyanqian
     * @date 2022/11/3
     */
    KEY(6, "钥匙"),

    ;

    /**
     * 类型
     * @author chenyanqian
     * @date 2022/11/3
     */
    private Integer type;

    /**
     * 名称
     * @author chenyanqian
     * @date 2022/11/3
     */
    private String name;

    DiggingShareRewardTypeEnums(Integer type, String name) {
        this.type = type;
        this.name = name;
    }

    /**
     * 根据type获取name值
     * @author chenyanqian
     * @date 2022/11/2
     * @param type : code
     * @return : java.lang.String
     */
    public static String getNameByType(Integer type){
        DiggingShareRewardTypeEnums[] enums = DiggingShareRewardTypeEnums.values();
        for (DiggingShareRewardTypeEnums rewardTypeEnums : enums){
            if(rewardTypeEnums.type.equals(type)){
                return rewardTypeEnums.name;
            }
        }
        return null;
    }
}
